﻿using IdentityServer4;
using IdentityServer4.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace User.Identity
{
    public class Config
    {
        public static List<Client> GetClients()
        {
            var clients = new List<Client>() {
                new Client()
                {
                    ClientId = "android",
                    ClientName="android",
                    ClientSecrets={ new Secret("p@ssw0rd".Sha256()) },
                    AllowedScopes={ "user_api","contact_api","user_identity","gateway_api","project_api","recommend_api",
                        IdentityServerConstants.StandardScopes.Phone,IdentityServerConstants.StandardScopes.OpenId,IdentityServerConstants.StandardScopes.Profile},
                    AllowedGrantTypes={ "sms_auth_code" }


                }
            };
            return clients;
        }
        public static IEnumerable<ApiResource> GetApiResources()
        {
            var resources = new List<ApiResource>()
            {
                new ApiResource("user_api","user_api"),
                new ApiResource("contact_api","contact_api"),
                new ApiResource("user_identity","user_identity"),
                new ApiResource("gateway_api","gateway_api"),
                new ApiResource("project_api","project_api"),
                new ApiResource("recommend_api","recommend_api")
            };
            return resources;
        }
        public static IEnumerable<IdentityResource> GetIdentityResources()
        {
            var resources = new List<IdentityResource>()
            {
                new IdentityResources.Phone(),
                new IdentityResources.OpenId(),
                new IdentityResources.Profile()
            };
            return resources;
        }
    }
}
